<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
test(() => assert_selection(
    [
        '<div contenteditable>',
            '<span>|XX<br>XX<br><br>XX<br><br><br><br>XX</span>',
        '</div>',
    ].join(''),
    selection => {
        function moveNSpacesAndType(n) {
            for (var i = 0; i < n; ++i)
                selection.modify('move', 'forward', 'character');
            for (var i = 0; i < 3; ++i)
                selection.document.execCommand('insertText', false, 'a');
        }
        moveNSpacesAndType(2);
        moveNSpacesAndType(3);
        moveNSpacesAndType(1);
        moveNSpacesAndType(3);
        moveNSpacesAndType(1);
        moveNSpacesAndType(1);
        moveNSpacesAndType(1);
        moveNSpacesAndType(3);
    },
    [
        '<div contenteditable>',
            '<span>XXaaa<br>XXaaa<br>aaa<br>XXaaa<br>aaa<br>aaa<br>aaa<br>XXaaa|</span>',
        '</div>',
    ].join('')),
    'Typing around BR');
</script>
